const { static } = require("express");
// 网站设置数据模型
module.exports = class Resume extends require("./model") {
    static getSetUp() {
        return new Promise((resolve, reject) => {
            let sql = "SELECT * FROM setUp";
            this.query(sql).then(res => {
                resolve(res);
            }).catch(err => {
                console.log(`获取网站设置数据失败：${err.message}`);
                reject(err);
            })
        })
    }
    static updateSetUp(data) {
        return new Promise((resolve, reject) => {
            console.log(data,'updateSetUp');
            // 编辑
            let sql = `UPDATE setup SET webName = ?,recordNumber = ?,copywriting = ?,logo = ?,indexImg = ? WHERE id = ?`
            const { webName, recordNumber, copywriting, logo, indexImg, id } = data
            this.query(sql, [webName || '', recordNumber || '', copywriting || '', logo || '', indexImg || '', 1]).then(data => {
                console.log(data,'query');
                resolve({
                    affectedRows: data.affectedRows,
                    msg: '编辑'
                });
            }).catch(err => {
                reject(err)
            })
        })
    }
}